package com.app.game.bet;

import java.io.Serializable;

import com.app.game.other.Credit;

public abstract class Bet implements Serializable{
	
	private static final long serialVersionUID = -5851490729693414550L;
	private Credit credit;
	protected int rating;
	
	protected void setRating(int rating){
		this.rating = rating;
	}
	
	
	public void setCredit(Credit rate) {
		this.credit = rate;
	}

	public Credit checkResults(int result){
		
		int value = credit.getValue();
		if(isWin(result)){
			
			int newvalue = value + (value * rating);
			credit.setValue(newvalue);
		}else{
			if(result == 0){
				credit.setValue(zero(value));
			}else{
				credit.setValue(0);
			}
		}
		return credit;
	}
	protected abstract boolean isWin(int result);
	protected abstract int zero(int value);
}
